package com.ganbo.thread;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CreateThread3 implements Callable {

    public Object call() throws Exception {
        System.out.println(Thread.currentThread().getName());
        return "SUCCESS";
    }

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        CreateThread3 c = new CreateThread3();
        FutureTask<String> future = new FutureTask<String>(c);
        Thread t = new Thread(future);
        t.start();

        System.out.println(Thread.currentThread().getName());
        System.out.println("子任务返回===>" + future.get());
    }
}
